%%%-------------------------------------------------------------------
%% @doc elock_step public API
%% @end
%%%-------------------------------------------------------------------

-module(elock_step_app).

-behaviour(application).
-include("elock_step.hrl").
-export([start/2, stop/1]).

start(_StartType, _StartArgs) ->
    CbModRet = application:get_env(elock_step, callback_mod),
    case CbModRet of
        undefined ->
            io:format("callback_mod undefined in app env ~n"),
            init:stop(1);
        {ok, CbMod} ->
            UpdateInterval = application:get_env(elock_step, update_interval, 50),
            elock_step_behaviour:set_elock_step_cb_mod(CbMod),
            elock_step_behaviour:set_elock_step_update_interval(UpdateInterval),
            {ok, SupPid} = elock_step_sup:start_link(),
            ls_room_sup:start_room_sup_child(SupPid),
            ls_util:start_mnesia(),
            {ok, SupPid}
    end.


stop(_State) ->
    ok.

%% internal functions
